//
//  CSGXSearchCell.m
//  CarSalesMS_GCX
//
//  Created by Ssky on 2016/11/16.
//  Copyright © 2016年 Tony. All rights reserved.
//

#import "CSGXSearchCell.h"
#import "CSSearchCellContent.h"

#import "TOrderInfoDAL.h"

@interface CSGXSearchCell ()


@property (nonatomic,weak) CSSearchCellContent * vContentSearchCell;

@end

@implementation CSGXSearchCell

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupUI];
    }
    return self;
}

#pragma mark - methods

- (void)distribute {
//    @{@"orderIndex":orderIndex, @"userName":userName, @"businessman":businessman, @"totalMoney":totalMoney}
    TOrderInfoModel * orderModel = self.dataDictSearch[@"orderModelSearch"];
    NSDictionary * contentDict = @{@"orderIndex":self.dataDictSearch[@"rowIndex"], @"userName":orderModel.orSalesman, @"businessman":orderModel.orBusinessman, @"totalMoney":@(orderModel.orTotalMoney)};
    
    self.vContentSearchCell.dataDictSearchCell = contentDict;
}


#pragma markl - setupUI
-(void) setupUI {
    //
//    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    UIView * bgSelectedView = [[UIView alloc] init];
    bgSelectedView.backgroundColor = [UIColor gx_colorWithRed:255 green:187 blue:51];
    self.selectedBackgroundView = bgSelectedView;
    //
    CSSearchCellContent * vContentSearchCell = [[CSSearchCellContent alloc] init];
    [self.contentView addSubview:vContentSearchCell];
    
    [vContentSearchCell mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.leading.trailing.equalTo(self.contentView);
    }];
    
    //
    self.vContentSearchCell = vContentSearchCell;
}


#pragma mark - setter & getter

- (void)setDataDictSearch:(NSDictionary *)dataDictSearch {
    _dataDictSearch = dataDictSearch;
    
    [self distribute];
}























@end
